package xyz.yuzegod.megawalls.command;

import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender;

public abstract class BaseCommand
{
    private String name;
    private String permission;
    
    public BaseCommand(final String name) {
        this.name = name;
    }
    
    public String getName() {
        return this.name;
    }
    
    public String getPermission() {
        return this.permission;
    }
    
    public void setPermission(final String permission) {
        this.permission = permission;
    }
    
    public final boolean hasPermission(final CommandSender sender) {
        return this.permission == null || sender.hasPermission(this.permission);
    }
    
    public abstract String getPossibleArguments();
    
    public abstract int getMinimumArguments();
    
    public abstract void execute(final CommandSender p0, final String p1, final String[] p2) throws CommandException;
    
    public abstract boolean isOnlyPlayerExecutable();
    
    public final boolean isValidTrigger(final String name) {
        return this.name.equalsIgnoreCase(name);
    }
}
